// pages/resume/resume.js
Page({
  data: {
    personInfoShow:true,
    educationShow: true,
    schoolShow: true,
    workShow: true,
    personInfo:{},
    workExp:[],
    education: [],
    assessment:{},
    personInfoModify:false,
    assessmentShow:true,
  },
  onLoad: function (options) {
    var that = this;
    wx.getStorage({
      key: 'personInfoData',
      success: function(res) {
        that.setData({
          personInfo:res.data
        })
        if (that.data.personInfo) {
          that.setData({
            personInfoShow: false,
            personInfoModify: true,
          })
        }
      },
    });
    wx.getStorage({
      key: 'education',
      success: function (res) {
        that.setData({
          education:res.data
        })
        if (that.data.education) {
          that.setData({
            educationShow: false,
          })
        }
      },
    });
    wx.getStorage({
      key: 'workExp',
      success: function (res) {
        that.setData({
          workExp: res.data
        })
        if (that.data.workExp) {
          that.setData({
            workShow: false,
          })
        }
      },
    });
    wx.getStorage({
      key:'assessment',
      success:function(res){
        that.setData({
          assessment:res.data,
          assessmentShow:false
        })
      }
    })
  },
  scanCode:function(){
    wx.navigateTo({
      url: 'scanComputer/scanComputer',
    })
  },
  infoAdd:function(){
    wx.navigateTo({
      url: 'personInfo/personInfo',
    })
  },
  educationAdd: function () {
    wx.navigateTo({
      url: 'education/education',
    })
  },
  workAdd: function () {
    wx.navigateTo({
      url: 'workExp/workExp',
    })
  },
  assessmentAdd:function(){
    wx.navigateTo({
      url: 'assessment/assessment',
    })
  },
  infoModify:function(){
    wx.navigateTo({
      url: 'personInfo/personInfo',
    })
  },
  assessmentModify:function(){
    wx.navigateTo({
      url: 'assessment/assessment',
    })
  },
  educationModify: function (e) {
    var that = this;
    var educationData = e.currentTarget.dataset.educationdata;
    var educationIndex=e.currentTarget.dataset.educationindex;
    wx.navigateTo({
      url: 'education/education?educationData=' + JSON.stringify(educationData) + '&&educationIndex=' + educationIndex,
    })
  },
  workModify: function (e) {
    var that = this;
    var workData = e.currentTarget.dataset.workdata;
    var workIndex = e.currentTarget.dataset.workindex;
    wx.navigateTo({
      url: 'workExp/workExp?workData=' + JSON.stringify(workData) + '&&workIndex=' + workIndex,
    })
  },
  educationContinue:function(){
    wx.navigateTo({
      url: 'education/education',
    })
  },
  workContinue: function () {
    wx.navigateTo({
      url: 'workExp/workExp',
    })
  },
  resumeUploading:function(){
    wx.navigateTo({
      url: 'uploading/uploading',
    })
  }
})